home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Installer SDK Cornucopia 1.0.2 / Script Examples / Preference⁄Setup Func. Example / setupFunScript.r < prev    next >
Encoding:
Text File  |  1996-09-30  |  3.8 KB  |  138 lines  |  [TEXT/MPS ]

  1. //
  2. //    setupFunScript.r
  3. //
  4. //        This example demonstrates usage of the Preference resource ('inpr') to
  5. //        call a Setup Function.  The Setup Function in this example searches
  6. //        for the first copy of the SimpleText (or TeachText) application found
  7. //        on the default target volume.  If a copy of the application is found,
  8. //        the FSSpec of its parent folder is returned to the Installer and is
  9. //        displayed as the recommended target folder to install our Example File into.
  10. //
  11. //        If the user clicks Install without selecting a different target folder,
  12. //      a Example File will be installed to the folder suggested by the Setup
  13. //        Function.  Otherwise, the Example File is installed into the user-selected
  14. //        folder.
  15. //
  16. //        NOTE: This example uses pre-4.0 method for creating Custom Install options.
  17. //        It is not intended as an example of how to use 4.0 User Interface features.
  18. //        (See the "Custom UI Example" for an example of the 4.0 Interface features.)
  19. //
  20. //        Copyright 1993-1996, Apple Computer, Inc., All Rights Reserved
  21. //
  22.  
  23. include "SetupFunction";                // our Setup Function code resource
  24.  
  25. #include "InstallerTypes.r"
  26.  
  27.  
  28. /************************** Target File Spec. resources **********************************/
  29. // target file spec for Example File
  30. resource 'intf' (10000) {
  31.     format1 {
  32.         noSearchForFile,                 // use default search path
  33.         
  34.         TypeCrMustMatch,                 // If this is set to TypeCrMustMatch
  35.                                         // then a file with a different type
  36.                                         // and creator than those specified
  37.                                         // below will not be replaced.
  38.                                         // If this is set to TypeCrNeedNotMatch
  39.                                         // then type and creator of an existing
  40.                                         // target file are ignored.
  41.         
  42.         // The Type and Creator fields will be used to set the
  43.         // file's Type and Creator when a new file is created. 
  44.         'ttro',                         // TYPE for new file
  45.         'ttxt',                         // CREATOR for new file
  46.         
  47.         0,                                 // finder attribute flags
  48.                                         // filled by ScriptCheck is value is 0
  49.         
  50.         1,                                  // creation date for new file
  51.         1,                                  // modification date for new file
  52.                                         // NOTE: DATE values are filled
  53.                                         // by ScriptCheck if the value is 1
  54.                                             
  55.         0,                                 // search proc ID ( 'insp' ), none used
  56.         
  57.         "folder-user:Example File"
  58.         }
  59.     };
  60.  
  61. /************************** Source File Spec. resources **********************************/
  62. resource 'infs' (20000) {
  63.     'ttro',
  64.     'ttxt',
  65.     0x1,
  66.     noSearchForFile,
  67.     TypeCrMustMatch,
  68.     "Tidbits:Example File"
  69. };
  70.  
  71. /************************** File Atom resource **********************************/
  72. resource 'infa' (10000) {
  73.     format1 {
  74.         deleteWhenRemoving,
  75.         deleteWhenInstalling,
  76.         copy,
  77.         dontIgnoreLockedFile,
  78.         dontSetFileLocked,
  79.         useVersProcToCompare,
  80.         srcNeedExist,
  81.         rsrcForkInRsrcFork,
  82.         leaveAloneIfNewer,
  83.         updateExisting,
  84.         copyIfNewOrUpdate,
  85.         rsrcFork,
  86.         dataFork,
  87.         0,
  88.         0,
  89.         10000,
  90.         {    20000, 0, 0
  91.         },
  92.         0x0,
  93.         0,
  94.         0,
  95.         ""
  96.     }
  97. };
  98.  
  99. /************************** Package resource **********************************/
  100. resource 'inpk' (20037) {
  101.     format0 {
  102.         showsOnCustom,
  103.         notRemovable,
  104.         dontForceRestart,
  105.         0,
  106.         0,
  107.         "Example File",
  108.         {    
  109.             'infa', 10000,
  110.         }
  111.     }
  112. };
  113.  
  114. /************************** Preference resource **********************************/
  115. resource 'inpr' (300) {
  116.     format0 {
  117.         useFolderTargetMode,            // Tells the Installer which interface to use, 
  118.                                         // either disk based or folder based
  119.                                         
  120.         dontAllowUserToSetSystemDisk,    // Restricts user from changing System Disk
  121.         showSelectedSizeInCustom,
  122.         setupFunctionSupplied,            // Tells Installer to call Setup Function
  123.         dontAllowCleanInstall,
  124.         dontAllowServerAsTarget,
  125.         'infn',                            // Setup Function code resource type
  126.         147,                            // Setup Function code resource ID
  127.         {    /* array helpPagelist: 2 elements */
  128.             /* [1] */    301, 311, 301, 311,
  129.             /* [2] */    302, 312, 302, 312
  130.         },
  131.         "Demo Install Folder"            // Default Target Folder name
  132.     }                                    // used if user creates a New folder...
  133. };
  134.  
  135.  
  136.  
  137.  
  138.